package com.iot08.api.controller;

import com.iot08.api.annotation.CheckAppSign;
import com.iot08.api.service.*;
import com.iot08.api.vo.request.*;
import com.iot08.api.vo.request.base.BaseAccountReqVO;
import com.iot08.common.utils.response.ResponseMap;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import javax.websocket.server.PathParam;
import java.io.IOException;

/**
 * @version 1.0
 * @Description:
 * @time: 2021/2/2 15:30
 * @author: Rock
 */
@RestController
@RequestMapping("20000")
public class JuHuoController {

    @Resource
    private AccountService accountService;
    @Resource
    private DeviceService deviceService;
    @Resource
    private DeviceLocationService deviceLocationService;
    @Resource
    private DeviceLocationDailyService deviceLocationDailyService;
    @Resource
    private DevicePhotographService devicePhotographService;
    @Resource
    private DeviceStepDailyService deviceStepDailyService;
    @Resource
    private HealthRemindService healthRemindService;

    @Resource
    private DeviceAppManagerService deviceAppManagerService;

    @Resource
    private TimeLimitDeviceAppManagerService timeLimitDeviceAppManagerService;

    @Resource
    private AutoCallService autoCallService;

    @Resource
    private ScreensaverService screensaverService;

    @Resource
    private InquirePhoneChargeService inquirePhoneChargeService;

    @Resource
    private RollTimeCommandService rollTimeCommandService;

    @Resource
    private RollTimeDataService rollTimeDataService;

    /**
     * 添加关联设备 (代理商的) 暂不支持先注释掉
     *
     * @param vo
     * @param bindingResult
     * @param image
     * @time: 2021/2/2 15:54
     * @author: Rock
     * @version 1.0
     */
    @PostMapping("accounts/{openid}/related-device")
    public ResponseMap addRelatedDevice(@Validated AddRelatedDeviceToJuHuoReqVO vo, BindingResult bindingResult,
                                        MultipartFile image) throws IOException {
        return accountService.addRelatedDeviceToJuHuo(vo, image);
    }

    /**
     * 解除设备关联 (代理商的) 暂不支持先注释掉
     *
     * @param vo
     * @param bindingResult
     * @time: 2021/2/2 16:02
     * @author: Rock
     * @version 1.0
     */
    @DeleteMapping("accounts/{openid}/related-device")
    public ResponseMap delRelatedDevice(@Validated ImeiParamReqVO vo, BindingResult bindingResult) {
        return accountService.delRelatedDeviceToJuHuo(vo);
    }

    /**
     * 查询语音提醒列表（闹钟）
     *
     * @param imei
     * @time: 2021/2/2 18:25
     * @author: Rock
     * @version 1.0
     */
    @GetMapping("devices/{imei}/voiceAlarm")
    public ResponseMap getVoiceAlarm(@PathVariable("imei") String imei) {
        return deviceService.getVoiceAlarm(imei);
    }

    /**
     * 添加语音提醒（闹钟）
     *
     * @param vo
     * @param bindingResult
     * @time: 2021/2/2 18:28
     * @author: Rock
     * @version 1.0
     */
    @PostMapping("devices/{imei}/voiceAlarm")
    public ResponseMap addVoiceAlarm(@PathVariable("imei") String imei,
                                     @Validated AddVoiceAlarmReqVO vo, BindingResult bindingResult,
                                     MultipartFile content) throws IOException {
        return deviceService.addVoiceAlarm(imei, vo, content);
    }

    /**
     * @description 设置智能闹钟开关
     * @author cwj
     * @param [imei, smartAlarmStatusVo]
     * @return com.iot08.common.utils.response.ResponseMap
     * @date @time 2025/5/19 17:43
     **/
    @PostMapping("devices/{imei}/smartAlarmStatus")
    public ResponseMap smartAlarmStatusSetting(@PathVariable("imei") String imei, @Validated SmartAlarmStatusVo vo) {
        return deviceService.smartAlarmStatusSetting(imei,vo);
    }


    /**
     * 修改语音提醒
     *
     * @param imei
     * @param vo
     * @param bindingResult
     * @param content
     * @time: 2021/2/3 10:53
     * @author: Rock
     * @version 1.0
     */
    @PatchMapping("devices/{imei}/voiceAlarm")
    public ResponseMap updateVoiceAlarm(@PathVariable("imei") String imei,
                                        @Validated UpdateVoiceAlarmReqVO vo, BindingResult bindingResult,
                                        MultipartFile content) throws IOException {
        return deviceService.updateVoiceAlarm(imei, vo, content);
    }

    @PostMapping("devices/{imei}/voiceAlarm/update")
    public ResponseMap updateVoiceAlarm_A(@PathVariable("imei") String imei,
                                        @Validated UpdateVoiceAlarmReqVO vo, BindingResult bindingResult,
                                        MultipartFile content) throws IOException {
        return deviceService.updateVoiceAlarm(imei, vo, content);
    }

    /**
     * 删除语音提醒
     *
     * @param imei
     * @param vo
     * @param bindingResult
     * @time: 2021/2/3 10:57
     * @author: Rock
     * @version 1.0
     */
    @DeleteMapping("devices/{imei}/voiceAlarm")
    public ResponseMap delVoiceAlarm(@PathVariable("imei") String imei,
                                     @Validated IdParamReqVO vo, BindingResult bindingResult) {
        return deviceService.delVoiceAlarm(imei, vo);
    }

    /**
     * 查询免打扰设置列表（上课禁用）
     *
     * @param imei
     * @time: 2021/2/3 11:14
     * @author: Rock
     * @version 1.0
     */
    @GetMapping("devices/{imei}/disturbBan")
    public ResponseMap getDisturbBan(@PathVariable("imei") String imei) {
        return deviceService.getDisturbBan(imei);
    }

    /**
     * 添加免打扰设置（上课禁用）
     *
     * @param imei
     * @param vo
     * @param bindingResult
     * @time: 2021/2/3 11:46
     * @author: Rock
     * @version 1.0
     */
    @PostMapping("devices/{imei}/disturbBan")
    public ResponseMap addDisturbBan(@PathVariable("imei") String imei, @Validated AddDisturbBanReqVO vo, BindingResult bindingResult) {
        return deviceService.addDisturbBan(imei, vo);
    }


    /**
     * @description 智能上课禁用开关设置
     * @author cwj
     * @param [imei, vo]
     * @return com.iot08.common.utils.response.ResponseMap
     * @date @time 2025/5/20 11:16
     **/
    @PostMapping("devices/{imei}/smartDisturbBanStatus")
    public ResponseMap smartDisturbBanStatusSetting(@PathVariable("imei") String imei, @Validated SmartDisturbBanStatusReqVO vo){
        return deviceService.smartDisturbBanStatusSetting(imei,vo);
    }


    /**
     * '
     * 修改免打扰设置
     *
     * @param imei
     * @param vo
     * @param bindingResult
     * @time: 2021/2/3 11:50
     * @author: Rock
     * @version 1.0
     */
    @PatchMapping("devices/{imei}/disturbBan")
    public ResponseMap updateDisturbBan(@PathVariable("imei") String imei,
                                        @Validated UpdateDisturbBanReqVO vo, BindingResult bindingResult) {
        return deviceService.updateDisturbBan(imei, vo);
    }
    @PostMapping("devices/{imei}/disturbBan/update")
    public ResponseMap updateDisturbBan_A(@PathVariable("imei") String imei,
                                        @Validated UpdateDisturbBanReqVO vo, BindingResult bindingResult) {
        return deviceService.updateDisturbBan(imei, vo);
    }

    /**
     * 删除免打扰设置
     *
     * @param imei
     * @param vo
     * @param bindingResult
     * @time: 2021/2/3 12:07
     * @author: Rock
     * @version 1.0
     */
    @DeleteMapping("devices/{imei}/disturbBan")
    public ResponseMap delDisturbBan(@PathVariable("imei") String imei,
                                     @Validated IdParamReqVO vo, BindingResult bindingResult) {
        return deviceService.delDisturbBan(imei, vo);
    }

    /**
     * 查询设备基本信息
     *
     * @param imei
     * @time: 2021/2/3 15:52
     * @author: Rock
     * @version 1.0
     */
    @GetMapping("devices/{imei}")
    public ResponseMap getDeviceInfo(@PathVariable("imei") String imei, @Validated BaseAccountReqVO vo) {
        return deviceService.getInfoToJuHuo(imei, vo);
    }

    /**
     * 修改设备信息
     *
     * @param imei
     * @param vo
     * @param bindingResult
     * @param image
     * @time: 2021/2/3 16:33
     * @author: Rock
     * @version 1.0
     */
    @PatchMapping("devices/{imei}")
    public ResponseMap updateDeviceInfo(@PathVariable("imei") String imei, @Validated DeviceUpdateInfoReqVO vo,
                                        BindingResult bindingResult, MultipartFile image) throws IOException {
        return deviceService.updateInfo(imei, vo, image);
    }

    @PostMapping("devices/{imei}/update")
    public ResponseMap updateDeviceInfo_A(@PathVariable("imei") String imei, @Validated DeviceUpdateInfoReqVO vo,
                                        BindingResult bindingResult, MultipartFile image) throws IOException {
        return deviceService.updateInfo(imei, vo, image);
    }

    /**
     * 操作设备
     *
     * @param imei
     * @param vo
     * @param bindingResult
     * @time: 2021/2/3 16:41
     * @author: Rock
     * @version 1.0
     */
    @PostMapping("devices/{imei}/operation")
    public ResponseMap operationDevice(@PathVariable("imei") String imei, @Validated OperationDeviceReqVO vo,
                                       BindingResult bindingResult) {
        return deviceService.operationDevice(imei, vo);
    }

    /**
     * @description 查询设备拨号盘开关状态，拒绝陌生人来电开关状态
     * @author cwj
     * @param [imei, vo]
     * @return com.iot08.common.utils.response.ResponseMap
     * @date @time 2025/4/25 18:05
     **/
    @GetMapping("devices/{imei}/dailSwitch")
    public ResponseMap getDailSwitch(@PathVariable("imei") String imei, @Validated BaseAccountReqVO vo) {
        return deviceService.getDailSwitch(imei);
    }


    //设置 DIY 设备上传的定位间隔时间
    @PostMapping("devices/{imei}/devlocatetime/diy")
    public ResponseMap postDIYDevlocatetime(@PathVariable("imei") String imei, OperationDeviceReqVO vo) {
        return deviceService.operationDevice(imei, vo);
    }

    /**
     * 获取管理员名称和电话号码
     * @param imei
     * @param vo
     * @param bindingResult
     * @time: 4/28/22 6:23 PM
     * @author: Weichao
     * @version 1.0
     */
    @GetMapping("devices/{imei}/operation")
    public ResponseMap getAdminInfo(@PathVariable("imei") String imei, @Validated BaseAccountReqVO vo,
                                       BindingResult bindingResult) {
        return deviceService.getAdminInfo(imei, vo);
    }


    /**
     * 发送设备验证码
     *
     * @param imei
     * @time: 2021/2/3 18:46
     * @author: Rock
     * @version 1.0
     */
    @PostMapping("devices/{imei}/authcode")
    public ResponseMap sendAuthCode(@PathVariable("imei") String imei) {
        return deviceService.sendAuthCode(imei);
    }

    /**
     * 查询设备定位历史轨迹
     *
     * @param imei
     * @param vo
     * @param bindingResult
     * @time: 2021/2/4 9:24
     * @author: Rock
     * @version 1.0
     */
    @GetMapping("devices/{imei}/location")
    public ResponseMap getDeviceLocation(@PathVariable("imei") String imei, @Validated GetLocationTOJuHuoReqVO vo,
                                         BindingResult bindingResult) {
        return deviceLocationService.getLocationToJuHuo(imei, vo);
    }

    /**
     * 上传某天定位点 的 解析位置数据 (文字轨迹列表)
     * @param imei
     * @param vo
     * @param bindingResult
     * @time: 4/29/22 10:19 AM
     * @author: Weichao
     * @version 1.0
     */
    @PostMapping("devices/{imei}/location")
    public ResponseMap postDeviceLocationAddr(@PathVariable("imei") String imei, @Validated PosttLocationTOJuHuoReqVO vo) {
        return deviceLocationService.postLocationToJuHuo(imei, vo);
    }


    /**
     * 查询设备最后一次定位
     *
     * @param imei
     * @time: 2021/2/4 9:47
     * @author: Rock
     * @version 1.0
     */
    @GetMapping("devices/{imei}/location/last")
    public ResponseMap getDeviceLocationLast(@PathVariable("imei") String imei, @PathParam("qAddress") Integer qAddress) {
        if(qAddress == null){
            qAddress = 0;
        }
        return deviceLocationService.getLocationLastToJuHuo(imei, qAddress);
    }

    /**
     * @description
     * @author cwj
     * @param [imei, vo]
     * @return com.iot08.common.utils.response.ResponseMap
     * @date @time 2024/12/28 17:19
     **/
    @PostMapping("devices/{imei}/location/last")
    public ResponseMap getDeviceNowLocation(@PathVariable("imei") String imei,@Validated BaseAccountReqVO vo) {
        return deviceLocationService.getNowLocationToJuHuo(imei, vo.getOpenid());
    }

    /**
     * 请求设备当前定位
     *
     * @param imei
     * @param vo
     * @time: 2021/2/4 9:50
     * @author: Rock
     * @version 1.0
     */
    @PostMapping("devices/location/last")
    @CheckAppSign
    public ResponseMap getDeviceNowLocation(@Validated @RequestBody DeviceNowLocationReqVo vo) {
        return deviceLocationService.getNowLocationToJuHuo(vo.getBodyForm().getImei(), vo.getBodyForm().getOpenid());
    }

    /**
     * 设备定位数据每日统计
     *
     * @param imei
     * @param vo
     * @time: 2021/2/4 10:14
     * @author: Rock
     * @version 1.0
     */
    @GetMapping("devices/{imei}/location/daily")
    public ResponseMap getDeviceLocationDaily(@PathVariable("imei") String imei, @Validated GetLocationTOJuHuoReqVO vo) {
        return deviceLocationDailyService.getLocationDailyToJuHuo(imei, vo);
    }

    /**
     * 删除定位数据每日统计
     *
     * @param imei
     * @param vo
     * @time: 2021/2/4 10:20
     * @author: Rock
     * @version 1.0
     */
    @DeleteMapping("devices/{imei}/location/daily")
    public ResponseMap delDeviceLocationDaily(@PathVariable("imei") String imei, @Validated DelDeviceDailyReqVO vo,
                                              BindingResult bindingResult) {
        return deviceLocationDailyService.delLocationDailyToJuHuo(imei, vo);
    }

    /**
     * 获取sos号码列表
     *
     * @param imei
     * @time: 2021/2/4 10:47
     * @author: Rock
     * @version 1.0
     */
    @GetMapping("devices/{imei}/sos")
    public ResponseMap getDeviceSos(@PathVariable("imei") String imei) {
        return deviceService.getSos(imei);
    }

    /**
     * 添加sos号码
     * @param imei
     * @param vo
     * @param bindingResult
     * @time: 2021/2/4 11:06
     * @author: Rock
     * @version 1.0
     */
    /*@PostMapping("devices/{imei}/sos")
    public ResponseMap addDeviceSos(@PathVariable("imei")String imei, @Validated PhoneParamReqVO vo,
                                    BindingResult bindingResult) {
        return deviceService.addSos(imei, vo);
    }*/

    /**
     * 修改sos号码
     *
     * @param imei
     * @param vo
     * @param bindingResult
     * @time: 2021/2/4 11:23
     * @author: Rock
     * @version 1.0
     */
    @PatchMapping("devices/{imei}/sos")
    public ResponseMap updateDeviceSos(@PathVariable("imei") String imei, @Validated UpdateSosReqVO vo,
                                       BindingResult bindingResult) {
        return deviceService.updateSos(imei, vo);
    }
    @PostMapping("devices/{imei}/sos/update")
    public ResponseMap updateDeviceSos_A(@PathVariable("imei") String imei, @Validated UpdateSosReqVO vo,
                                       BindingResult bindingResult) {
        return deviceService.updateSos(imei, vo);
    }

    /**
     * 删除sos号码
     * @param imei
     * @param vo
     * @param bindingResult
     * @time: 2021/2/4 11:27
     * @author: Rock
     * @version 1.0
     */
    /*@DeleteMapping("devices/{imei}/sos")
    public ResponseMap delDeviceSos(@PathVariable("imei")String imei, @Validated IdParamReqVO vo,
                                       BindingResult bindingResult) {
        return deviceService.delSos(imei, vo);
    }*/

    /**
     * 查询照片列表
     *
     * @param imei
     * @param vo
     * @param bindingResult
     * @time: 2021/2/4 12:02
     * @author: Rock
     * @version 1.0
     */
    @GetMapping("devices/{imei}/photograph")
    public ResponseMap getPhotoGraph(@PathVariable("imei") String imei, @Validated ChatGroupGetMessageReqVO vo,
                                     BindingResult bindingResult) {
        return devicePhotographService.getPhotoGraph(imei, vo);
    }

    /**
     * 删除远程照片
     *
     * @param imei
     * @param vo
     * @param bindingResult
     * @time: 2021/2/4 12:02
     * @author: Rock
     * @version 1.0
     */
    @DeleteMapping("devices/{imei}/photograph")
    public ResponseMap delPhotoGraph(@PathVariable("imei") String imei, @Validated IdsParamReqVO vo,
                                     BindingResult bindingResult) {
        return devicePhotographService.delPhotoGraph(imei, vo);
    }

    /**
     * 查询今日计步统计
     *
     * @param imei
     * @param vo
     * @param bindingResult
     * @time: 2021/2/4 14:30
     * @author: Rock
     * @version 1.0
     */
    @GetMapping("devices/{imei}/step/daily")
    public ResponseMap getDeviceStepDaily(@PathVariable("imei") String imei, @Validated DateParamReqVO vo,
                                          BindingResult bindingResult) {
        return deviceStepDailyService.getStepDaily(imei, vo);
    }

    /**
     * 设置今日目标步数
     *
     * @param imei
     * @param vo
     * @param bindingResult
     * @time: 2021/2/4 14:28
     * @author: Rock
     * @version 1.0
     */
    @PostMapping("devices/{imei}/step/daily")
    public ResponseMap addTodayTargetStep(@PathVariable("imei") String imei, @Validated TargetParamReqVO vo,
                                          BindingResult bindingResult) {
        return deviceStepDailyService.addTodayTargetStep(imei, vo);
    }


    /**
     * @description:获取健康检查的信息
     * @author cwj
     * @param [imei, vo, bindingResult]
     * @return com.iot08.common.utils.response.ResponseMap
     * @date @time 2024/11/13 9:59
     **/
    @GetMapping("devices/{imei}/health/remind")
    public ResponseMap queryHealthRemind(@PathVariable("imei") String imei, @Validated HealthRemindQueryReqVo vo) {
        return healthRemindService.queryHealthRemind(imei, vo);
    }


    /**
     * @description 设置健康提醒功能（2：喝水提醒，1：久坐提醒）
     * @author cwj
     * @param [imei, vo, bindingResult]
     * @return com.iot08.common.utils.response.ResponseMap
     * @date @time 2024/11/11 9:09
     **/
    @PostMapping("devices/{imei}/health/remind")
    public ResponseMap settingHealthRemind(@PathVariable("imei") String imei, @Validated HealthRemindReqVo vo) {
         return healthRemindService.settingHealthRemind(imei, vo);
    }

    /**
     * @description 查询App应用数据
     * @author cwj
     * @param [imei]
     * @return com.iot08.common.utils.response.ResponseMap
     * @date @time 2024/11/14 18:29
     **/
    @GetMapping("devices/{imei}/app/manager")
    public ResponseMap queryDeviceAppManager(@PathVariable("imei") String imei,@Validated BaseAccountReqVO vo){
        return deviceAppManagerService.queryDeviceAppManager(imei,vo);
    }

    /**
     * @description 设置App应用启禁状态
     * @author cwj
     * @param [imei, vo]
     * @return com.iot08.common.utils.response.ResponseMap
     * @date @time 2024/11/15 10:59
     **/
    @PostMapping("devices/{imei}/app/manager")
    public ResponseMap settingDeviceAppManager(@PathVariable("imei") String imei, @Validated AppManagerReqVo vo){
        return deviceAppManagerService.settingDeviceAppManager(imei,vo);
    }

    /**
     * @description 查询App应用限制时间段指令数据
     * @author cwj
     * @param [imei, vo]
     * @return com.iot08.common.utils.response.ResponseMap
     * @date @time 2024/11/19 15:42
     **/
    @GetMapping("devices/{imei}/timeLimit/appManager")
    public ResponseMap queryTimeLimitDeviceAppManager(@PathVariable("imei") String imei, @Validated BaseAccountReqVO vo){
        return timeLimitDeviceAppManagerService.queryTimeLimitDeviceAppManager(imei);
    }

    /**
     * @description 设置App应用限制时间段禁止使用
     * @author cwj
     * @param [imei, vo]
     * @return com.iot08.common.utils.response.ResponseMap
     * @date @time 2024/11/19 15:07
     **/
    @PostMapping("devices/{imei}/timeLimit/appManager")
    public ResponseMap settingTimeLimitDeviceAppManager(@PathVariable("imei") String imei, @Validated TimeLimitAppManagerReqVo vo){
        return timeLimitDeviceAppManagerService.settingTimeLimitDeviceAppManager(imei,vo);
    }

    /**
     * @description 查询自动接听指令设置信息
     * @author cwj
     * @param [imei, vo]
     * @return com.iot08.common.utils.response.ResponseMap
     * @date @time 2024/12/18 14:51
     **/
    @GetMapping("devices/{imei}/auto/call")
    public ResponseMap queryAutoCall(@PathVariable("imei") String imei,@Validated BaseAccountReqVO vo){
        return autoCallService.queryAutoCall(imei);
    }

    /**
     * @description 设置自动接听设置指令
     * @author cwj
     * @param [imei, vo]
     * @return com.iot08.common.utils.response.ResponseMap
     * @date @time 2024/12/18 14:52
     **/
    @PostMapping("devices/{imei}/auto/call")
    public ResponseMap settingAutoCall(@PathVariable("imei") String imei, @Validated AutoCallReqVo vo){
        return autoCallService.settingAutoCall(imei,vo);
    }


    /**
     * @description 查询设备屏保信息
     * @author cwj
     * @param [imei, vo]
     * @return com.iot08.common.utils.response.ResponseMap
     * @date @time 2024/12/18 15:01
     **/
    @GetMapping("devices/{imei}/screensaver")
    public ResponseMap queryScreensaver(@PathVariable("imei") String imei,@Validated BaseAccountReqVO vo){
        return screensaverService.queryScreensaver(imei);
    }


    /**
     * @description 设置屏保信息
     * @author cwj
     * @param [imei, vo]
     * @return com.iot08.common.utils.response.ResponseMap
     * @date @time 2024/12/18 15:02
     **/
    @PostMapping("devices/{imei}/screensaver")
    public ResponseMap settingScreensaver(@PathVariable("imei") String imei,@Validated ScreensaverReqVo vo,MultipartFile image){
        return screensaverService.settingScreensaver(imei,vo,image);
    }


    /**
     * 查询日、周、月排行榜
     * @param imei
     * @param vo
     * @param bindingResult
     * @time: 3/12/22 5:57 PM
     * @author: Weichao
     * @version 1.0
     */
    @GetMapping("devices/{imei}/step/ranking")
    public ResponseMap getRanking(@PathVariable("imei") String imei, @Validated StepTankingReqVO vo,
                                          BindingResult bindingResult) {
        return deviceStepDailyService.getRanking(imei, vo);
    }

    /**
     * @description 查询设备sim卡的话费流量
     * @author cwj
     * @param [vo]
     * @return com.iot08.common.utils.response.ResponseMap
     * @date @time 2025/3/23 15:14
     **/
    @PostMapping("/devices/inquirePhoneCharge")
    public ResponseMap settingPhoneCharges(@Validated InquirePhoneChargeReqVo vo){
        return inquirePhoneChargeService.settingPhoneCharges(vo);
    }

    /**
     * @description 查询设备发生的查询流量话费的指令
     * @author cwj
     * @param [vo]
     * @return com.iot08.common.utils.response.ResponseMap
     * @date @time 2025/3/23 18:17
     **/
    @GetMapping("/devices/queryPhoneCharge")
    public ResponseMap queryPhoneCharge(@Validated InquirePhoneChargeQueryReqVo vo){
         return inquirePhoneChargeService.queryPhoneCharge(vo);
    }

    /**
     * @description 设置夜间省电模式的状态
     * @author cwj
     * @param [imei, vo]
     * @return com.iot08.common.utils.response.ResponseMap
     * @date @time 2025/5/4 17:15
     **/
    @PostMapping("/devices/powerSaving")
    public ResponseMap settingPowerSaving(@Validated PowerSavingModeReqVo vo){
        return deviceService.settingPowerSaving(vo);
    }

    /**
     * @description 查询设备夜间省电模式状态
     * @author cwj
     * @param [vo]
     * @return com.iot08.common.utils.response.ResponseMap
     * @date @time 2025/5/4 18:00
     **/
    @GetMapping("/devices/queryPowerSaving")
    public ResponseMap queryPowerSavingMode(@Validated PowerSavingModeQueryReqVo vo){
        return deviceService.queryPowerSavingMode(vo);
    }

    /**
     * @description 设置夜间睡眠检测（翻滚次数）功能
     * @author cwj
     * @param [vo]
     * @return com.iot08.common.utils.response.ResponseMap
     * @date @time 2025/5/9 15:27
     **/
    @PostMapping("/devices/rollTimeDetection")
    public ResponseMap settingRollTimeDetection(@Validated RollTimeDetectionReqVo vo){
        return rollTimeCommandService.settingRollTimeDetection(vo);
    }


    /**
     * @description 查询设备翻滚指令设置的信息
     * @author cwj
     * @param [rollTimesReqVo]
     * @return com.iot08.common.utils.response.ResponseMap
     * @date @time 2025/5/11 9:49
     **/
    @GetMapping("/devices/queryRollTimeCommand")
    public ResponseMap queryRollTimeCommand(@Validated RollTimeReqVo vo){
        return rollTimeCommandService.queryRollTimeCommand(vo.getImei());
    }

    /**
     * @description 查询一周内睡眠质量的数据
     * @author cwj
     * @param [rollTimesReqVo]
     * @return com.iot08.common.utils.response.ResponseMap
     * @date @time 2025/5/11 9:47
     **/
    @GetMapping("/devices/queryRollTimeInfo")
    public ResponseMap queryRollTimeInfo(@Validated RollTimeReqVo vo){
        return rollTimeDataService.queryRollTimeInfo(vo.getImei());
    }


}
